package SwordOffer;

public class Sword_Offer_15 {

    public int hammingWeight(int n) {
        int count = 0;
        while (n != 0) {
            count += Math.abs(n % 2);
            n >>>= 1;
        }
        return count;
    }

    public static void main(String[] args) {
        Sword_Offer_15 model = new Sword_Offer_15();
//        System.out.println(model.hammingWeight(11));
//        System.out.println(model.hammingWeight(128));
        System.out.println(model.hammingWeight(-3));
    }
}
